from app import db

class SportRecords(db.Model):
    __tablename__ = 'sport_records'

    user_id = db.Column(db.String(255), db.ForeignKey('user_info.user_id'), primary_key=True)
    workout_type = db.Column(db.String(255))
    intensity = db.Column(db.Integer)
    heart_rate_avg = db.Column(db.Integer)
    heart_rate_max = db.Column(db.Integer)
    heart_rate_rest = db.Column(db.Integer)
    calories_burned = db.Column(db.Integer)
    duration = db.Column(db.Integer)
    water_intake_L = db.Column(db.Float)
    weather = db.Column(db.String(255))
    experience_level = db.Column(db.String(255))
    start_time = db.Column(db.String(255))
    end_time = db.Column(db.String(255))

    user = db.relationship('UserInfo', backref='sport_records')

    def __repr__(self):
        return f'<SportRecords {self.user_id}, {self.workout_type}>'
